Administrating agents and service requests
In Plant Modeller, Agents provide a file-based message exchange system that a peer system can use to request services from the Agent. The peer system writes a service request file and (optionally) data files to a shared directory, and when the Agent notices the file it processes the request specified by the request file.
Perhaps the most typical usage is to request the Agent to import 3D geometry from a file provided by the peer system, or to request the Agent to export 3D geometry for import to the peer system.
Agents can be created, started and stopped from the CADMATIC desktop. There is a fixed number of existing Agent services in the system. Additional ones that implement specific functionality can be requested from Cadmatic Customer Support.
How service requests work
Agents provide a non-interactive method for transferring and processing project data by means of service request files. The service request file is a structured text file which defines the specific service to be requested, and it can also reference data files that the Agent is to process as part of the request.
The Agent expects the service request file and the referenced data files to appear in a specific folder. The folder's location can be changed from the Agent's properties, but by default it is the following:
.../Site/pm/AgentRequests/[AgentName].pm/
When the Agent finds a new service request file from this location, it executes the request and writes an acknowledge file to the same folder. The acknowledge files consists of request status, which can be success or failure, and in the case of failure the acknowledge file also contains an error message.
Thus, it is expected that after writing the request file to the shared folder, also the peer application polls the shared folder for the acknowledge file to appear in it.
Processing service requests with Plant Modeller service instances
Also a Plant Modeller Service Instance that has been installed to the project can, among other things, execute service requests.
In the Plant Modeller Service Instance Settings dialog, on the General tab (see General tab), selecting the option Enable support for Plant Agent clients allows the Service Instance to poll its shared folder and execute the request files that arrive in that folder, in the same way as Agents do.
The shared folder's location for a Service Instance is the following:
.../Site/pm/AgentRequests/[ServiceInstanceName].pm/
Creating new agents
Use the CADMATIC desktop to create a new Agent.
Do the following:
-
In the CADMATIC desktop, select the appropriate agent from Object > Create Area For:
In this example we create a new Plant Agent.
-
Enter a name for the new Agent and click OK.
-
In the properties dialog, you can specify the shared folder that the Agent polls for new service requests.
The variable PM_AGENT_REQ_ROOTDIR defines the root directory where the program will add a folder named after the Agent: [AgentName].pm. The default root directory is .../Site/pm/AgentRequests/.
Click Done.
-
In the Set Area Limits & Save dialog, define the limits of the area as described in Set limits and save, and click Apply & Save.
-
You can now start the Agent by selecting the Agent's shortcut and then Object > Start Plant Agent.
-
Define the start parameters and click OK.
-
The opening of an empty Plant Modeller application window indicates that the Agent is now running and polling the shared folder.
Note: You can minimize this window, but do not try to close it from the window itself.
-
You can select the Agent's shortcut and then Object > Start Plant Modeller to edit the area of the Agent with a normal Plant Modeller interface. This is useful for example if the Agent has encountered some problems and you need to investigate the issue in the 3D model.
-
To stop the Agent, select the Agent's shortcut and then Object > Stop Plant Agent.
This closes the Agent's Plant Modeller window, and any new service requests that arrive in the shared folder will be ignored.